<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>活动筛选 | 社交平台</title>
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
    <style>
        :root {
            --primary: #4263eb;
            --secondary: #36b37e;
            --light-gray: #f8f9fa;
            --dark-gray: #343a40;
            --text-gray: #6c757d;
        }
        
        body {
            background-color: #f5f7fa;
            font-family: 'Segoe UI', system-ui, sans-serif;
        }
        
        .filter-section {
            background-color: white;
            border-radius: 8px;
            box-shadow: 0 2px 10px rgba(0,0,0,0.05);
            margin-bottom: 2rem;
        }
        
        .filter-header {
            padding: 1rem 1.5rem;
            border-bottom: 1px solid #eee;
            display: flex;
            justify-content: space-between;
            align-items: center;
        }
        
        .filter-content {
            padding: 1.5rem;
        }
        
        .filter-group {
            margin-bottom: 1.5rem;
        }
        
        .filter-title {
            font-weight: 600;
            margin-bottom: 0.75rem;
            color: var(--dark-gray);
        }
        
        .chip {
            display: inline-block;
            padding: 0.25rem 0.75rem;
            background-color: var(--light-gray);
            border-radius: 20px;
            margin-right: 0.5rem;
            margin-bottom: 0.5rem;
            font-size: 0.85rem;
            cursor: pointer;
            transition: all 0.2s ease;
        }
        
        .chip:hover {
            background-color: #e9ecef;
        }
        
        .chip.active {
            background-color: var(--primary);
            color: white;
        }
        
        .range-slider {
            width: 100%;
            margin: 1rem 0;
        }
        
        .search-input-group {
            position: relative;
        }
        
        .search-input-group input {
            padding-left: 2.5rem;
        }
        
        .search-icon {
            position: absolute;
            left: 0.75rem;
            top: 50%;
            transform: translateY(-50%);
            color: var(--text-gray);
        }
        
        .event-card {
            transition: transform 0.3s ease, box-shadow 0.3s ease;
            margin-bottom: 1.5rem;
        }
        
        .event-card:hover {
            transform: translateY(-5px);
            box-shadow: 0 10px 20px rgba(0,0,0,0.1);
        }
        
        .event-author {
            font-size: 0.85rem;
            color: var(--text-gray);
        }
        
        .event-stats {
            font-size: 0.85rem;
            color: var(--text-gray);
        }
        
        .stat-item {
            display: flex;
            align-items: center;
            margin-right: 1rem;
        }
        
        .stat-item i {
            margin-right: 4px;
        }
        
        .action-btn {
            background: none;
            border: none;
            color: var(--text-gray);
            transition: color 0.2s ease;
        }
        
        .action-btn:hover {
            color: var(--primary);
        }
        
        .action-btn.liked {
            color: #e74c3c;
        }
        
        .action-btn.saved {
            color: var(--secondary);
        }
        
        .image-grid {
            display: grid;
            grid-template-columns: repeat(2, 1fr);
            gap: 4px;
        }
        
        .applied-filters {
            padding: 1rem 1.5rem;
            background-color: #f8f9fa;
            border-top: 1px solid #eee;
        }
        
        .applied-filter-tag {
            display: inline-flex;
            align-items: center;
            padding: 0.25rem 0.75rem;
            background-color: white;
            border-radius: 20px;
            margin-right: 0.5rem;
            margin-bottom: 0.5rem;
            font-size: 0.85rem;
            box-shadow: 0 1px 3px rgba(0,0,0,0.1);
        }
        
        .applied-filter-tag .remove-filter {
            margin-left: 0.5rem;
            cursor: pointer;
            color: var(--text-gray);
        }
        
        .toggle-filters {
            display: none;
            margin-bottom: 1rem;
        }
        
        @media (max-width: 768px) {
            .toggle-filters {
                display: block;
            }
            
            .filter-sidebar {
                display: none;
                margin-bottom: 1.5rem;
            }
            
            .filter-sidebar.show {
                display: block;
            }
        }
    </style>
</head>
<body>
    <div class="container py-5">
        <h2 class="mb-4">活动筛选</h2>
        
        <!-- 移动端筛选切换按钮 -->
        <button class="btn btn-outline-primary w-100 toggle-filters" id="toggleFilters">
            <i class="fas fa-filter me-2"></i>筛选条件
        </button>
        
        <div class="row">
            <!-- 筛选侧边栏 -->
            <div class="col-md-3 filter-sidebar" id="filterSidebar">
                <div class="filter-section">
                    <div class="filter-header">
                        <h5 class="mb-0">筛选条件</h5>
                        <button class="btn btn-sm btn-link text-muted" id="clearAllFilters">
                            清除全部
                        </button>
                    </div>
                    
                    <div class="filter-content">
                        <!-- 搜索框 -->
                        <div class="filter-group">
                            <div class="search-input-group">
                                <i class="fas fa-search search-icon"></i>
                                <input type="text" class="form-control" placeholder="搜索活动名称或描述">
                            </div>
                        </div>
                        
                        <!-- 活动类型筛选 -->
                        <div class="filter-group">
                            <h6 class="filter-title">活动类型</h6>
                            <div>
                                <span class="chip active">全部</span>
                                <span class="chip">音乐</span>
                                <span class="chip">体育</span>
                                <span class="chip">艺术</span>
                                <span class="chip">美食</span>
                                <span class="chip">讲座</span>
                                <span class="chip">公益</span>
                                <span class="chip">聚会</span>
                            </div>
                        </div>
                        
                        <!-- 日期筛选 -->
                        <div class="filter-group">
                            <h6 class="filter-title">活动日期</h6>
                            <div>
                                <span class="chip active">全部时间</span>
                                <span class="chip">今天</span>
                                <span class="chip">明天</span>
                                <span class="chip">本周</span>
                                <span class="chip">本月</span>
                                <span class="chip">自定义</span>
                            </div>
                            
                            <div class="row mt-3" style="display: none;" id="customDateRange">
                                <div class="col-6">
                                    <input type="date" class="form-control form-control-sm">
                                </div>
                                <div class="col-6">
                                    <input type="date" class="form-control form-control-sm">
                                </div>
                            </div>
                        </div>
                        
                        <!-- 距离筛选 -->
                        <div class="filter-group">
                            <h6 class="filter-title">距离范围</h6>
                            <input type="range" min="1" max="50" value="10" class="range-slider" id="distanceSlider">
                            <div class="d-flex justify-content-between">
                                <span class="text-sm text-muted">1公里</span>
                                <span class="text-sm font-medium" id="distanceValue">10公里</span>
                                <span class="text-sm text-muted">50公里</span>
                            </div>
                        </div>
                        
                        <!-- 价格筛选 -->
                        <div class="filter-group">
                            <h6 class="filter-title">价格范围</h6>
                            <div class="row">
                                <div class="col-6">
                                    <select class="form-select form-select-sm">
                                        <option value="0">最低 ¥0</option>
                                        <option value="50">¥50</option>
                                        <option value="100">¥100</option>
                                        <option value="200">¥200</option>
                                        <option value="500">¥500</option>
                                    </select>
                                </div>
                                <div class="col-6">
                                    <select class="form-select form-select-sm">
                                        <option value="10000">最高 ¥10000+</option>
                                        <option value="200">¥200</option>
                                        <option value="500">¥500</option>
                                        <option value="1000">¥1000</option>
                                        <option value="2000">¥2000</option>
                                    </select>
                                </div>
                            </div>
                        </div>
                        
                        <!-- 参与人数筛选 -->
                        <div class="filter-group">
                            <h6 class="filter-title">参与人数</h6>
                            <div>
                                <span class="chip">不限</span>
                                <span class="chip active">10人以下</span>
                                <span class="chip">10-50人</span>
                                <span class="chip">50-100人</span>
                                <span class="chip">100人以上</span>
                            </div>
                        </div>
                        
                        <!-- 排序方式 -->
                        <div class="filter-group">
                            <h6 class="filter-title">排序方式</h6>
                            <select class="form-select">
                                <option value="recommend">推荐排序</option>
                                <option value="latest">最新发布</option>
                                <option value="popular">热门优先</option>
                                <option value="distance">距离最近</option>
                            </select>
                        </div>
                    </div>
                    
                    <!-- 已选筛选条件 -->
                    <div class="applied-filters">
                        <h6 class="mb-2">已选条件</h6>
                        <div>
                            <span class="applied-filter-tag">
                                10人以下
                                <i class="fas fa-times remove-filter"></i>
                            </span>
                            <span class="applied-filter-tag">
                                10公里内
                                <i class="fas fa-times remove-filter"></i>
                            </span>
                        </div>
                    </div>
                </div>
            </div>
            
            <!-- 活动列表 -->
            <div class="col-md-9">
                <!-- 筛选结果统计 -->
                <div class="d-flex justify-content-between align-items-center mb-4">
                    <p class="text-muted mb-0">找到 <strong>24</strong> 个符合条件的活动</p>
                    <div class="d-flex gap-2">
                        <button class="btn btn-sm btn-outline-secondary active" id="listView">
                            <i class="fas fa-list"></i>
                        </button>
                        <button class="btn btn-sm btn-outline-secondary" id="gridView">
                            <i class="fas fa-th"></i>
                        </button>
                    </div>
                </div>
                
                <!-- 活动列表 -->
                <div class="event-list">
                    <!-- 活动项1 -->
                    <div class="card event-card">
                        <div class="d-flex gap-3">
                            <div class="flex-shrink-0" style="width: 150px; height: 120px;">
                                <img src="https://picsum.photos/300/240?random=1" class="w-100 h-100 object-cover rounded" alt="小型读书会活动">
                            </div>
                            <div class="flex-grow-1 min-w-0 p-3">
                                <div class="d-flex justify-content-between">
                                    <div>
                                        <h5 class="mb-1">小型文学读书会</h5>
                                        <p class="text-truncate text-muted mb-2" style="max-width: 400px;">
                                            周末小型读书会，探讨近期热门书籍，欢迎文学爱好者参与交流
                                        </p>
                                    </div>
                                    <div class="text-end">
                                        <small class="text-muted d-block">周六 15:00</small>
                                        <div class="mt-1">
                                            <button class="action-btn like-btn">
                                                <i class="far fa-heart"></i>
                                            </button>
                                            <button class="action-btn save-btn">
                                                <i class="far fa-bookmark"></i>
                                            </button>
                                        </div>
                                    </div>
                                </div>
                                <div class="d-flex flex-wrap gap-3">
                                    <span class="event-author">
                                        <img src="https://picsum.photos/30/30?random=101" class="rounded-circle me-1" width="16" height="16">
                                        读书会组织者
                                    </span>
                                    <span class="text-sm text-muted">
                                        <i class="fas fa-map-marker-alt me-1 text-primary"></i>
                                        距离 2.5 公里
                                    </span>
                                    <span class="badge bg-light text-dark">
                                        免费
                                    </span>
                                    <span class="badge bg-light text-dark">
                                        讲座
                                    </span>
                                </div>
                                <div class="d-flex event-stats mt-2">
                                    <div class="stat-item">
                                        <i class="fas fa-eye"></i> 89
                                    </div>
                                    <div class="stat-item">
                                        <i class="fas fa-comment"></i> 12
                                    </div>
                                    <div class="stat-item">
                                        <i class="fas fa-user"></i> 8人参加
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                    
                    <!-- 活动项2 -->
                    <div class="card event-card">
                        <div class="d-flex gap-3">
                            <div class="flex-shrink-0" style="width: 150px; height: 120px;">
                                <div class="image-grid h-100">
                                    <img src="https://picsum.photos/300/240?random=2" class="w-100 h-100 object-cover rounded-top rounded-start" alt="咖啡品鉴">
                                    <img src="https://picsum.photos/300/240?random=3" class="w-100 h-100 object-cover rounded-bottom rounded-start" alt="咖啡制作">
                                </div>
                            </div>
                            <div class="flex-grow-1 min-w-0 p-3">
                                <div class="d-flex justify-content-between">
                                    <div>
                                        <h5 class="mb-1">精品咖啡品鉴会</h5>
                                        <p class="text-truncate text-muted mb-2" style="max-width: 400px;">
                                            专业咖啡师带你品尝世界各地精品咖啡，学习咖啡知识
                                        </p>
                                    </div>
                                    <div class="text-end">
                                        <small class="text-muted d-block">周日 10:30</small>
                                        <div class="mt-1">
                                            <button class="action-btn like-btn">
                                                <i class="far fa-heart"></i>
                                            </button>
                                            <button class="action-btn save-btn">
                                                <i class="far fa-bookmark"></i>
                                            </button>
                                        </div>
                                    </div>
                                </div>
                                <div class="d-flex flex-wrap gap-3">
                                    <span class="event-author">
                                        <img src="https://picsum.photos/30/30?random=102" class="rounded-circle me-1" width="16" height="16">
                                        咖啡师Mike
                                    </span>
                                    <span class="text-sm text-muted">
                                        <i class="fas fa-map-marker-alt me-1 text-primary"></i>
                                        距离 5.2 公里
                                    </span>
                                    <span class="badge bg-light text-dark">
                                        ¥88
                                    </span>
                                    <span class="badge bg-light text-dark">
                                        美食
                                    </span>
                                </div>
                                <div class="d-flex event-stats mt-2">
                                    <div class="stat-item">
                                        <i class="fas fa-eye"></i> 156
                                    </div>
                                    <div class="stat-item">
                                        <i class="fas fa-comment"></i> 24
                                    </div>
                                    <div class="stat-item">
                                        <i class="fas fa-user"></i> 6人参加
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                    
                    <!-- 活动项3 (无图片) -->
                    <div class="card event-card">
                        <div class="d-flex gap-3">
                            <div class="flex-shrink-0" style="width: 150px; height: 120px; background-color: var(--light-gray);">
                                <div class="h-100 d-flex align-items-center justify-content-center">
                                    <i class="fas fa-chess text-4xl text-muted"></i>
                                </div>
                            </div>
                            <div class="flex-grow-1 min-w-0 p-3">
                                <div class="d-flex justify-content-between">
                                    <div>
                                        <h5 class="mb-1">周末围棋交流赛</h5>
                                        <p class="text-truncate text-muted mb-2" style="max-width: 400px;">
                                            围棋爱好者小型交流赛，无论水平高低都可参与，以棋会友
                                        </p>
                                    </div>
                                    <div class="text-end">
                                        <small class="text-muted d-block">周六 9:00</small>
                                        <div class="mt-1">
                                            <button class="action-btn like-btn">
                                                <i class="far fa-heart"></i>
                                            </button>
                                            <button class="action-btn save-btn">
                                                <i class="far fa-bookmark"></i>
                                            </button>
                                        </div>
                                    </div>
                                </div>
                                <div class="d-flex flex-wrap gap-3">
                                    <span class="event-author">
                                        <img src="https://picsum.photos/30/30?random=103" class="rounded-circle me-1" width="16" height="16">
                                        围棋社社长
                                    </span>
                                    <span class="text-sm text-muted">
                                        <i class="fas fa-map-marker-alt me-1 text-primary"></i>
                                        距离 8.7 公里
                                    </span>
                                    <span class="badge bg-light text-dark">
                                        免费
                                    </span>
                                    <span class="badge bg-light text-dark">
                                        体育
                                    </span>
                                </div>
                                <div class="d-flex event-stats mt-2">
                                    <div class="stat-item">
                                        <i class="fas fa-eye"></i> 76
                                    </div>
                                    <div class="stat-item">
                                        <i class="fas fa-comment"></i> 9
                                    </div>
                                    <div class="stat-item">
                                        <i class="fas fa-user"></i> 5人参加
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                    
                    <!-- 活动项4 -->
                    <div class="card event-card">
                        <div class="d-flex gap-3">
                            <div class="flex-shrink-0" style="width: 150px; height: 120px;">
                                <img src="https://picsum.photos/300/240?random=4" class="w-100 h-100 object-cover rounded" alt="摄影小聚">
                            </div>
                            <div class="flex-grow-1 min-w-0 p-3">
                                <div class="d-flex justify-content-between">
                                    <div>
                                        <h5 class="mb-1">城市街头摄影小聚</h5>
                                        <p class="text-truncate text-muted mb-2" style="max-width: 400px;">
                                            摄影爱好者周末小聚，一起探索城市角落，交流摄影技巧
                                        </p>
                                    </div>
                                    <div class="text-end">
                                        <small class="text-muted d-block">周日 8:00</small>
                                        <div class="mt-1">
                                            <button class="action-btn like-btn">
                                                <i class="far fa-heart"></i>
                                            </button>
                                            <button class="action-btn save-btn">
                                                <i class="far fa-bookmark"></i>
                                            </button>
                                        </div>
                                    </div>
                                </div>
                                <div class="d-flex flex-wrap gap-3">
                                    <span class="event-author">
                                        <img src="https://picsum.photos/30/30?random=104" class="rounded-circle me-1" width="16" height="16">
                                        摄影师阿K
                                    </span>
                                    <span class="text-sm text-muted">
                                        <i class="fas fa-map-marker-alt me-1 text-primary"></i>
                                        距离 3.8 公里
                                    </span>
                                    <span class="badge bg-light text-dark">
                                        免费
                                    </span>
                                    <span class="badge bg-light text-dark">
                                        艺术
                                    </span>
                                </div>
                                <div class="d-flex event-stats mt-2">
                                    <div class="stat-item">
                                        <i class="fas fa-eye"></i> 124
                                    </div>
                                    <div class="stat-item">
                                        <i class="fas fa-comment"></i> 18
                                    </div>
                                    <div class="stat-item">
                                        <i class="fas fa-user"></i> 9人参加
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                
                <!-- 分页 -->
                <nav class="mt-4">
                    <ul class="pagination justify-content-center">
                        <li class="page-item disabled">
                            <a class="page-link" href="#" tabindex="-1">上一页</a>
                        </li>
                        <li class="page-item active"><a class="page-link" href="#">1</a></li>
                        <li class="page-item"><a class="page-link" href="#">2</a></li>
                        <li class="page-item"><a class="page-link" href="#">3</a></li>
                        <li class="page-item">
                            <a class="page-link" href="#">下一页</a>
                        </li>
                    </ul>
                </nav>
            </div>
        </div>
    </div>

    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
    <script>
        // 筛选标签切换
        document.querySelectorAll('.chip').forEach(chip => {
            chip.addEventListener('click', function() {
                // 如果点击的是"全部"或"全部时间"，取消同组其他选中状态
                if (this.textContent.includes('全部')) {
                    const parentGroup = this.parentElement;
                    parentGroup.querySelectorAll('.chip').forEach(c => {
                        c.classList.remove('active');
                    });
                } 
                // 如果点击的不是"全部"，取消同组的"全部"选中状态
                else {
                    const parentGroup = this.parentElement;
                    parentGroup.querySelectorAll('.chip').forEach(c => {
                        if (c.textContent.includes('全部')) {
                            c.classList.remove('active');
                        }
                    });
                }
                
                // 切换当前标签状态
                this.classList.toggle('active');
                
                // 处理自定义日期显示
                if (this.textContent === '自定义') {
                    document.getElementById('customDateRange').style.display = 'flex';
                } else if (!this.parentElement.querySelector('.chip.active')?.textContent.includes('自定义')) {
                    document.getElementById('customDateRange').style.display = 'none';
                }
            });
        });
        
        // 距离滑块
        const distanceSlider = document.getElementById('distanceSlider');
        const distanceValue = document.getElementById('distanceValue');
        
        distanceSlider.addEventListener('input', function() {
            distanceValue.textContent = `${this.value}公里`;
        });
        
        // 移动端筛选切换
        document.getElementById('toggleFilters').addEventListener('click', function() {
            document.getElementById('filterSidebar').classList.toggle('show');
        });
        
        // 清除所有筛选条件
        document.getElementById('clearAllFilters').addEventListener('click', function() {
            document.querySelectorAll('.chip').forEach(chip => {
                chip.classList.remove('active');
                // 激活"全部"选项
                if (chip.textContent.includes('全部')) {
                    chip.classList.add('active');
                }
            });
            
            // 重置滑块
            distanceSlider.value = 10;
            distanceValue.textContent = '10公里';
            
            // 隐藏自定义日期
            document.getElementById('customDateRange').style.display = 'none';
            
            // 重置价格选择
            document.querySelectorAll('select').forEach(select => {
                select.selectedIndex = 0;
            });
            
            // 清空已选条件
            document.querySelector('.applied-filters div').innerHTML = '';
        });
        
        // 移除已选筛选条件
        document.querySelectorAll('.remove-filter').forEach(btn => {
            btn.addEventListener('click', function() {
                this.parentElement.remove();
                // 这里可以添加逻辑来重置对应的筛选条件
            });
        });
        
        // 切换列表/网格视图
        document.getElementById('listView').addEventListener('click', function() {
            this.classList.add('active');
            document.getElementById('gridView').classList.remove('active');
            document.querySelector('.event-list').classList.remove('row');
            document.querySelectorAll('.event-card').forEach(card => {
                card.classList.remove('col-md-6');
            });
        });
        
        document.getElementById('gridView').addEventListener('click', function() {
            this.classList.add('active');
            document.getElementById('listView').classList.remove('active');
            document.querySelector('.event-list').classList.add('row');
            document.querySelectorAll('.event-card').forEach(card => {
                card.classList.add('col-md-6');
            });
        });
        
        // 点赞功能
        document.querySelectorAll('.like-btn').forEach(btn => {
            btn.addEventListener('click', function() {
                this.classList.toggle('liked');
                const icon = this.querySelector('i');
                
                if (this.classList.contains('liked')) {
                    icon.classList.remove('far');
                    icon.classList.add('fas');
                } else {
                    icon.classList.remove('fas');
                    icon.classList.add('far');
                }
            });
        });
        
        // 收藏功能
        document.querySelectorAll('.save-btn').forEach(btn => {
            btn.addEventListener('click', function() {
                this.classList.toggle('saved');
                const icon = this.querySelector('i');
                
                if (this.classList.contains('saved')) {
                    icon.classList.remove('far');
                    icon.classList.add('fas');
                } else {
                    icon.classList.remove('fas');
                    icon.classList.add('far');
                }
            });
        });
    </script>
</body>
</html>
    
